<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>智慧验车</title>
    <link rel="stylesheet" href="<%= request.getContextPath()%>/weui-1.1.1/dist/style/weui.min.css"/>
    <link rel="stylesheet" href="<%= request.getContextPath()%>/weui-1.1.1/dist/style/icon.css"/>
    <link rel="stylesheet" href="<%= request.getContextPath()%>/weui-1.1.1/dist/example/example.css"/>
    
    <style>
    	/**
		 * 表格
		 */
		.weui-table {
		  width: 100%;
		  border-collapse: collapse;    background-color: #fff;
		    line-height: 32px;
		    text-align: center; }
		.weui-table th {
		  font-weight: 500; }
		
		.weui-table td, .weui-table th {
		  border-bottom: 1px solid #e0e0e0;
		  border-right: 1px solid #e0e0e0;
		  text-align: center; }
		
		@media screen and (-webkit-min-device-pixel-ratio: 2) {
		  .weui-table td, .weui-table th {
		    position: relative;
		    border-right: 0;
		    border-bottom: 0; }
		
		  .weui-table td:after, .weui-table th:after {
		    content: "";
		    position: absolute;
		    width: 100%;
		    height: 100%;
		    left: 0;
		    top: 0;
		    background-image: -webkit-gradient(linear, left top, right top, color-stop(0.5, transparent), color-stop(0.5, #e0e0e0), to(#e0e0e0)), -webkit-gradient(linear, left top, left bottom, color-stop(0.5, transparent), color-stop(0.5, #e0e0e0), to(#e0e0e0));
		    background-size: 1px 100% ,100% 1px;
		    background-repeat: no-repeat;
		    background-position: right, bottom; }
		
		  .weui-table tr td:last-child:after, .weui-table tr th:last-child:after {
		    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.5, transparent), color-stop(0.5, #e0e0e0), to(#e0e0e0));
		    background-size: 100% 1px;
		    background-repeat: no-repeat;
		    background-position: bottom; }
		
		  .weui-table tr:last-child td:not(:last-child):after {
		    background-image: -webkit-gradient(linear, left top, right top, color-stop(0.5, transparent), color-stop(0.5, #e0e0e0), to(#e0e0e0));
		    background-size: 1px 100%;
		    background-repeat: no-repeat;
		    background-position: right; } }
		.weui-table tr td:last-child, .weui-table tr th:last-child {
		  border-right: 0; }
		
		.weui-table tr:last-child td {
		  border-bottom: 0; }
    </style>
</head>
<body ontouchstart>
    <div class="weui-toptips weui-toptips_warn js_tooltips">错误提示</div>

    <div class="container" id="container"></div>

    <script type="text/html" id="tpl_home">
	<div class="page">
    <div class="page__hd">
        <h1 class="page__title">
            <img src="<%= request.getContextPath()%>/images/logo.png" alt="智慧验车" height="60px" />
        </h1>
		<p class="page__desc"><strong>智慧验车</strong></p>
    </div>
    <div class="page__bd page__bd_spacing">
    	<div class="page__hd">
       		<p class="page__desc"></p>
       		<p class="page__desc"></p>
       		<p class="page__desc"></p>
       		<p class="page__desc"></p>
    	</div>
    	<div class="weui-grids">
        <a href="javascript:;" class="weui-grid js_item" data-id="mycheckcarmgmt" data-callback="myCheckCarMgmt">
            <div class="weui-grid__icon">
            	<span class="icon icon-67"></span>
            </div>
            <p class="weui-grid__label">车辆管理</p>
        </a>
        <a href="javascript:;" class="weui-grid js_item" data-id="myordermgmt" data-callback="myOrderMgmt">
            <div class="weui-grid__icon">
                <span class="icon icon-51"></span>
            </div>
            <p class="weui-grid__label">我的预约</p>
        </a>
        <a href="javascript:;" class="weui-grid js_item" data-id="datatable" data-callback="dataTable">
            <div class="weui-grid__icon">
                <span class="icon icon-27"></span>
            </div>
            <p class="weui-grid__label">验车场</p>
        </a>
        <a href="javascript:;" class="weui-grid js_item">
            <div class="weui-grid__icon">
                <span class="icon icon-65"></span>
            </div>
            <p class="weui-grid__label">6年免检</p>
        </a>
        <a href="javascript:;" class="weui-grid js_item">
            <div class="weui-grid__icon">
               <span class="icon icon-69"></span>
            </div>
            <p class="weui-grid__label">地图导航</p>
        </a>
        <a href="javascript:;" class="weui-grid js_item">
            <div class="weui-grid__icon">
                <span class="icon icon-88"></span>
            </div>
            <p class="weui-grid__label">帮助</p>
        </a>
       
    </div>
</div>
    <div class="page__ft">
        <a href="javascript:home()"><img src="<%= request.getContextPath()%>/weui-1.1.1/dist/example/images/icon_footer.png" /></a>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        var winH = $(window).height();
        var categorySpace = 10;

        $(document).on('click', '.js_item' ,function(){
			var callback = $(this).attr("data-callback");
			var params = $(this).attr("data-callback-param");
			if(callback) {
				var id = $(this).data('id');
				window[callback](id,params);
			}
			else {
				var id = $(this).data('id');
            	window.pageManager.go(id);
			}
        });

        $('.js_category').on('click', function(){
            var $this = $(this),
                $inner = $this.next('.js_categoryInner'),
                $page = $this.parents('.page'),
                $parent = $(this).parent('li');
            var innerH = $inner.data('height');
            bear = $page;

            if(!innerH){
                $inner.css('height', 'auto');
                innerH = $inner.height();
                $inner.removeAttr('style');
                $inner.data('height', innerH);
            }

            if($parent.hasClass('js_show')){
                $parent.removeClass('js_show');
            }else{
                $parent.siblings().removeClass('js_show');

                $parent.addClass('js_show');
                if(this.offsetTop + this.offsetHeight + innerH > $page.scrollTop() + winH){
                    var scrollTop = this.offsetTop + this.offsetHeight + innerH - winH + categorySpace;

                    if(scrollTop > this.offsetTop){
                        scrollTop = this.offsetTop - categorySpace;
                    }

                    $page.scrollTop(scrollTop);
                }
            }
        });
    });


	function myCheckCarMgmt(id) {
		var obj = {};
		var saveData = JSON.stringify(obj);
		var param = {
				saveData:saveData,
	   		}
		$('#checkCarMgmt').html("");//清空原数据
		$.ajax({
	        url: "myCheckCarMgmt",
	        dataType: 'json',
	        type: 'post',
	        data: param,
	        success: function(result){

				//查询成功，展示页面
	        	var html="";
	            	$.each(result.rows,function(index,data){
	        		html+="<div class='weui-form-preview__hd'>";
	        		html+="<label class='weui-form-preview__label'>车牌号</label>";
	        		html+="<em class='weui-form-preview__value' style='color: #FF0000;'>"+data.plateNo+"</em></div>";
	        		html+="<div class='weui-form-preview__bd'>";
	        		html+="<div class='weui-form-preview__item'>";
	        		html+="<label class='weui-form-preview__label'>车辆类型</label>";
	        		html+="<span class='weui-form-preview__value'>";
	        		if(data.vehicleType == '1'){
	        			html+="大型货车";
	        		} else if(data.vehicleType == '2'){
	        			html+="小型货车";
	        		} else if(data.vehicleType == '3'){
	        			html+="小型客车";
	        		}
	        		html+="</span></div>";
	        		html+="<div class='weui-form-preview__item'><label class='weui-form-preview__label'>行使证所有人</label>";
	        		html+="<span class='weui-form-preview__value'>"+data.owner+"</span></div><div class='weui-form-preview__item'>";
	        		html+="<label class='weui-form-preview__label'>车辆识别代码</label>";
	        		html+="<span class='weui-form-preview__value'>"+data.vin+"</span></div>";
	        		html+="<div class='weui-form-preview__item'><label class='weui-form-preview__label'>登记时间</label><span class='weui-form-preview__value'>";
	        		if(data.registerDate == 'a'){
	        			html+="6年以内";
	        		} else if(data.registerDate == 'b'){
	        			html+="6至10年";
	        		} else if(data.registerDate == 'c'){
	        			html+="10年以上";
	        		}
	        		html+="</span></div>";
	        		html+="</div>";
	        		
	        		var params = data.vehicleId+"|"+data.plateNo+"|"+data.owner+"|"+data.registerDate+"|"+data.vehicleType+"|"+data.vin;
	        		if(data.isSuccess == 1){
	        			html+="<div class='weui-form-preview__ft'><a class='weui-form-preview__btn weui-form-preview__btn_default' href='javascript:'>已完成</a></div>";
	        		}else if(data.isSuccess == 0 && data.isValid == 1){
	        			html+="<div class='weui-form-preview__ft'><a class='weui-form-preview__btn weui-form-preview__btn_default' href='javascript:'>不可验车</a></div>";
	        		}else if(data.isSuccess == 0 && data.isValid == 0){
	        			html+="<div class='weui-form-preview__ft'><a class='weui-form-preview__btn weui-form-preview__btn_primary js_item' href='javascript:' data-id='checkcarpre' data-callback='checkCarPre' data-callback-param='"+params+"'>前去验车</a></div>";
	        		}
	        	});

				var orig = $($("#tpl_mycheckcarmgmt").html());
				var ref = orig.find("#checkCarMgmt").html(html);
				$("#tpl_" + id).html(orig);

				window.pageManager.go(id);
	        },
			error : function() {
				alert("查询失败");
			}
		})
	}

	function checkCarPre(id,oparams) {
		var params = new String(oparams).split("|");
		var obj = {"vehicleId":params[0],
				   "plateNo":params[1],
				   "owner":params[2],
				   "registerDate":params[3],
				   "vehicleType":params[4],
				    "vin":params[5]};
		var saveData = JSON.stringify(obj);
		var param = {
				saveData:saveData,
	   		}

		$('#checkCarPre').html("");//清空原数据
		$.ajax({
	        url: "checkCarPre",
	        dataType: 'json',
	        type: 'post',
	        data: param,
	        success: function(result){
				//查询成功，展示页面
	        	var html="";
	        	html+="<input type='hidden' name='vehicleId' id='vehicleId' value='"+result.vehicleId+"'/>";
	        	html+="<input type='hidden' name='owner' id='owner' value='"+result.owner+"'/>";
	        	html+="<input type='hidden' name='registerDate' id='registerDate' value='"+result.registerDate+"'/>";
	        	html+="<input type='hidden' name='vehicleType' id='vehicleType' value='"+result.vehicleType+"'/>";
	        	html+="<input type='hidden' name='vin' id='vin' value='"+result.vin+"'/>";
	        	html+="<div class='page__hd'>";
	        	html+="<p class='page__desc' style='font-size: 24px; color: #FF9966; margin-bottom: 10px; line-height: 24px;'>请选择验车地点</p>";
	        	html+="</div>";
	        	html+="<div class='page__bd'>";
	        	html+="<div class='weui-cells'>";
	        	html+="<div class='weui-cell'>";
	        	html+="<div class='weui-cell__bd'>";
	        	html+="<p>验车车牌号 :</p>";
	        	html+="</div>";
	        	html+="<div class='weui-cell__ft'>"+result.plateNo+"<input type='hidden' name='plateNo' id='plateNo' value='"+result.plateNo+"'/></div>";
	        	html+="</div>";
	        	html+="</div>";
	        	html+="<div class='weui-cells'>";
	        	html+="<div class='weui-cell weui-cell_select weui-cell_select-after'>";
	        	html+="<div class='weui-cell__hd'>";
	        	html+="<label for='' class='weui-label'>验车地点 :</label>";
	        	html+="</div>";
	        	html+="<div class='weui-cell__bd'>";
	        	html+="<select class='weui-select' name='shopId' id='shopId'>";
	        	$.each(result.shopsList,function(index,data){
	        		html+="<option value='"+data.id+"'>"+data.name+"</option>";
	        	})
	        	html+="</select>";
	        	html+="</div>";
	        	html+="</div>";
	        	html+="</div>";
	        	html+="<div class='weui-btn-area'>";
	        	html+="<a class='weui-btn weui-btn_primary js_item' href='javascript:' data-id='checkcarconfirm' data-callback='checkCarConfirm'>确定</a>";
	        	html+="</div>";

				var orig = $($("#tpl_checkcarpre").html());
				var ref = orig.find("#checkCarPre").html(html);
				$("#tpl_" + id).html(orig);

				window.pageManager.go(id);
	        },
			error : function() {
				alert("查询失败");
			}
		})
	}

	function checkCarAddPre(id) {
		var obj = {};
		var saveData = JSON.stringify(obj);
		var param = {
				saveData:saveData,
	   		}
		$('#checkCarAddPre').html("");//清空原数据
		$.ajax({
	        url: "checkCarAddPre",
	        dataType: 'json',
	        type: 'post',
	        data: param,
	        success: function(result){
	        	//查询成功，展示页面
	        	var html="";
	        	html+="<div class='page__hd'>";
	        	html+="<p class='page__desc' style='font-size: 24px; color: #FF9966; margin-bottom: 10px; line-height: 24px;'>添加车辆信息</p>";
	        	html+="</div>";
	        	html+="<div class='page__bd'>";
	        	html+="<div class='weui-cell weui-cell_select weui-cell_select-after'>";
	        	html+="<div class='weui-cell__hd'>";
	        	html+="<label for='' class='weui-label'>车辆类型</label>";
	        	html+="</div>";
	        	html+="<div class='weui-cell__bd'>";
	        	html+="<select class='weui-select' name='vehicleType' id='vehicleType'>";
	        	html+="<option value='1'>大型货车</option>";
	        	html+="<option value='2'>小型货车</option>";
	        	html+="<option value='3'>小型客车</option>";
	        	html+="</select></div></div>";
	        	html+="<div class='weui-cell weui-cell_select weui-cell_select-after'>";
	        	html+="<div class='weui-cell__hd'>";
	        	html+="<label for='' class='weui-label'>车牌所在地 </label>";
	        	html+="</div>";
	        	html+="<div class='weui-cell__bd'>";
	        	html+="<select class='weui-select' name='address' id='address'>";
	        	html+="<option value='1'>北京市(京)</option> <option value='2'>天津市(津)</option><option value='3'>河北省(冀)</option><option value='4'>山西省(晋)</option>";
	        	html+="<option value='5'>内蒙古自治区(蒙)</option><option value='6'>辽宁省(辽)</option><option value='7'>吉林省(吉)</option><option value='8'>黑龙江省(黑)</option>";
	        	html+="<option value='9'>上海市(沪)</option><option value='10'>江苏省(苏)</option><option value='11'>浙江省(浙)</option><option value='12'>安徽省(皖)</option>";
	        	html+="<option value='13'>福建省(闽)</option><option value='14'>江西省(赣)</option><option value='15'>山东省(鲁)</option><option value='16'>河南省(豫)</option>";
	        	html+="<option value='17'>湖北省(鄂)</option><option value='18'>湖南省(湘)</option><option value='19'>广东省(粤)</option><option value='20'>广西壮族自治区(桂)</option>";
	        	html+="<option value='21'>海南省(琼)</option><option value='22'>四川省(川)</option><option value='23'>贵州省(贵)</option><option value='24'>云南省(云)</option>";
	        	html+="<option value='25'>重庆市(渝)</option><option value='26'>西藏自治区(藏)</option><option value='27'>陕西省(陕)</option><option value='28'>甘肃省(甘)</option>";
	        	html+="<option value='29'>青海省(青)</option><option value='30'>宁夏回族自治区(宁)</option><option value='31'>新疆维吾尔自治区(新)</option>";
	        	html+="</select></div></div>";
	        	html+="<div class='weui-cells weui-cells_form'>";
	        	html+="<div class='weui-cell'>";
	        	html+="<div class='weui-cell__hd'><label class='weui-label'>验车车牌号</label></div>";
	        	html+="<div class='weui-cell__bd'>";
	        	html+="<input class='weui-input' name='plateNo' id='plateNo' type='text' pattern='[0-9|a-z|A-Z]*' placeholder=''/>";
	        	html+="</div></div>";
	        	html+="<div class='weui-cell'>";
	        	html+="<div class='weui-cell__hd'><label class='weui-label'>行使证所有人</label></div>";
	        	html+="<div class='weui-cell__bd'>";
	        	html+="<input class='weui-input' name='owner' id='owner' type='text'  placeholder=''/>";
	        	html+="</div></div>";
	        	html+="<div class='weui-cell'>";
	        	html+="<div class='weui-cell__hd'><label class='weui-label'>车辆识别代码</label></div>";
	        	html+="<div class='weui-cell__bd'>";
	        	html+="<input class='weui-input' name='engineNo' id='engineNo' type='text'  placeholder=''/>";
	        	html+="</div></div></div>";
	        	html+="<div class='weui-cell weui-cell_select weui-cell_select-after'>";
	        	html+="<div class='weui-cell__hd'>";
	        	html+="<label for='' class='weui-label'>登记时间</label>";
	        	html+="</div>";
	        	html+="<div class='weui-cell__bd'>";
	        	html+="<select class='weui-select' name='registerDate' id='registerDate'>";
	        	html+="<option value='a'>6年以内</option><option value='b'>6至10年</option><option value='c'>10年以上</option>";
	        	html+="</select></div></div>";
	        	html+="<div class='weui-btn-area'>";
	        	html+="<a class='weui-btn weui-btn_primary js_item' href='javascript:' data-id='checkcaradd' data-callback='checkCarAdd'>确定</a>";
	        	html+="</div></div></div>";
	        	
	        	var orig = $($("#tpl_checkcaraddpre").html());
				var ref = orig.find("#checkCarAddPre").html(html);
				$("#tpl_" + id).html(orig);

				window.pageManager.go(id);
	        },
			error : function() {
				alert("查询失败");
			}
		})
	}

	function checkCarAdd(id) {
		var vehicleType = $("#vehicleType").val();
		if(vehicleType == ''){
			alert('车辆类型不能为空');
			return;
		}
		var address = $("#address").val();
		if(address == ''){
			alert('车牌所在地不能为空');
			return;
		}
		var plateNo = $("#plateNo").val();
		if(plateNo == ''){
			alert('验车车牌号不能为空');
			return;
		}
		var owner  = $("#owner").val();
		if(owner == ''){
			alert('行使证所有人不能为空');
			return;
		}
		var engineNo = $("#engineNo").val();
		if(engineNo == ''){
			alert('车辆识别代码不能为空');
			return;
		}
		var registerDate = $("#registerDate").val();
		if(registerDate == ''){
			alert('登记时间不能为空');
			return;
		}

		var obj = {
             "vehicleType":vehicleType,
             "address":address,
             "plateNo":plateNo,
             "owner":owner,
             "engineNo":engineNo,
             "registerDate":registerDate};

		var saveData = JSON.stringify(obj);
		var param = {
			saveData:saveData,
	   	}

		$('#checkCarAdd').html("");//清空原数据
		$.ajax({
	        url: "checkCarAdd",
	        dataType: 'json',
	        type: 'post',
	        data: param,
	        success: function(result){
				//查询成功，展示页面
	        	var html="";
	            	$.each(result.rows,function(index,data){
	        		html+="<div class='weui-form-preview__hd'>";
	        		html+="<label class='weui-form-preview__label'>车牌号</label>";
	        		html+="<em class='weui-form-preview__value' style='color: #FF0000;'>"+data.plateNo+"</em></div>";
	        		html+="<div class='weui-form-preview__bd'>";
	        		html+="<div class='weui-form-preview__item'>";
	        		html+="<label class='weui-form-preview__label'>车辆类型</label>";
	        		html+="<span class='weui-form-preview__value'>";
	        		if(data.vehicleType == '1'){
	        			html+="大型货车";
	        		} else if(data.vehicleType == '2'){
	        			html+="小型货车";
	        		} else if(data.vehicleType == '3'){
	        			html+="小型客车";
	        		}
	        		html+="</span></div>";
	        		html+="<div class='weui-form-preview__item'><label class='weui-form-preview__label'>行使证所有人</label>";
	        		html+="<span class='weui-form-preview__value'>"+data.owner+"</span></div><div class='weui-form-preview__item'>";
	        		html+="<label class='weui-form-preview__label'>车辆识别代码</label>";
	        		html+="<span class='weui-form-preview__value'>"+data.vin+"</span></div>";
	        		html+="<div class='weui-form-preview__item'><label class='weui-form-preview__label'>登记时间</label><span class='weui-form-preview__value'>";
	        		if(data.registerDate == 'a'){
	        			html+="6年以内";
	        		} else if(data.registerDate == 'b'){
	        			html+="6至10年";
	        		} else if(data.registerDate == 'c'){
	        			html+="10年以上";
	        		}
	        		html+="</span></div>";
	        		html+="</div>";
	        		
	        		var params = data.vehicleId+"|"+data.plateNo+"|"+data.owner+"|"+data.registerDate+"|"+data.vehicleType+"|"+data.vin;
	        		if(data.isSuccess == 1){
	        			html+="<div class='weui-form-preview__ft'><a class='weui-form-preview__btn weui-form-preview__btn_default' href='javascript:'>已完成</a></div>";
	        		}else if(data.isSuccess == 0 && data.isValid == 1){
	        			html+="<div class='weui-form-preview__ft'><a class='weui-form-preview__btn weui-form-preview__btn_default' href='javascript:'>不可验车</a></div>";
	        		}else if(data.isSuccess == 0 && data.isValid == 0){
						html+="<div class='weui-form-preview__ft'><a class='weui-form-preview__btn weui-form-preview__btn_primary js_item' href='javascript:' data-id='checkcarpre' data-callback='checkCarPre' data-callback-param='"+params+"'>前去验车</a></div>";
	        		}
	        	});

				var orig = $($("#tpl_checkcaradd").html());
				var ref = orig.find("#checkCarAdd").html(html);
				$("#tpl_" + id).html(orig);

				window.pageManager.go(id);
	        },
			error : function() {
				alert("查询失败");
			}
		})
	}


	function myOrderMgmt(id) {
		var obj = {};
		var saveData = JSON.stringify(obj);
		var param = {
				saveData:saveData,
	   		}
		$('#orderMgmt').html("");//清空原数据
		$.ajax({
	        url: "myOrderMgmt",
	        dataType: 'json',
	        type: 'post',
	        data: param,
	        success: function(result){
				//查询成功，展示页面
	        	var html="";
	        	$.each(result.rows,function(index,data){
	        		if(data.isSuccess == 1 && data.overdueFlag == 1){
	        			html+="<div class='weui-form-preview__hd'>";
		        		html+="<label class='weui-form-preview__label'>车牌号</label>";
		        		html+="<em class='weui-form-preview__value' style='color: #FF0000;'>"+data.plateNo+"</em></div>";
		        		html+="<div class='weui-form-preview__bd'>";
		        		if(data.checkFlag == 1){
		        			html+="<div class='weui-form-preview__item'>";
			        		html+="<label class='weui-form-preview__label'>预约时间</label>";

							if(data.beforeCountCar == 0 ){
  			        			html+="<span class='weui-form-preview__value' style='color: #00ff00;'><strong style='color: #0000FF;'>请去窗口验车</strong>"+"</span></div>";
			        		} else {
			        			html+="<span class='weui-form-preview__value' style='color: #00ff00;'>"+"今天需要验车,前方验车人数：<strong style='color: #A020F0;'>"+data.beforeCountCar+"</strong> 人"+"</span></div>";
			        		}
		        		} else {
		        			html+="<div class='weui-form-preview__item'>";
			        		html+="<label class='weui-form-preview__label'>预约时间</label>";
			        		html+="<span class='weui-form-preview__value' style='color: #9400D3;'>"+data.orderDate+"</span></div>";
		        		}
		        		html+="<div class='weui-form-preview__item'>";
		        		html+="<label class='weui-form-preview__label'>车辆类型</label>";
		        		html+="<span class='weui-form-preview__value'>";
		        		if(data.vehicleType == '1'){
		        			html+="大型货车";
		        		} else if(data.vehicleType == '2'){
		        			html+="小型货车";
		        		} else if(data.vehicleType == '3'){
		        			html+="小型客车";
		        		}
		        		html+="</span></div>";
		        		
		        		html+="<div class='weui-form-preview__item'><label class='weui-form-preview__label'>行使证所有人</label>";
		        		html+="<span class='weui-form-preview__value'>"+data.owner+"</span></div><div class='weui-form-preview__item'>";
		        		html+="<label class='weui-form-preview__label'>车辆识别代码</label>";
		        		html+="<span class='weui-form-preview__value'>"+data.vin+"</span></div>";
		        		html+="<div class='weui-form-preview__item'><label class='weui-form-preview__label'>登记时间</label><span class='weui-form-preview__value'>";
		        		if(data.registerDate == 'a'){
		        			html+="6年以内";
		        		} else if(data.registerDate == 'b'){
		        			html+="6至10年";
		        		} else if(data.registerDate == 'c'){
		        			html+="10年以上";
		        		}
		        		html+="</span></div>";
		        		html+="</div>";
					}
	        	});
				
				var orig = $($("#tpl_myordermgmt").html());
				var ref = orig.find("#orderMgmt").html(html);
				$("#tpl_" + id).html(orig);

				window.pageManager.go(id);
	        },
			error : function() {
				alert("查询失败");
			}
		})
	}

	function checkCarConfirm(id) {
		 var obj = {
             "shopId":$("#shopId").val(),
             "vehicleId":$("#vehicleId").val(),
			 "plateNo":$("#plateNo").val(),
 			 "owner":$("#owner").val(),
			 "registerDate":$("#registerDate").val(),
			 "vehicleType":$("#vehicleType").val(),
			 "vin":$("#vin").val()};
		var saveData = JSON.stringify(obj);
		var param = {
				saveData:saveData,
	   		}
		$('#data_list_pannel').html("");//清空原数据
		$.ajax({
	        url: "checkCarConfirm",
	        dataType: 'json',
	        type: 'post',
	        data: param,
	        success: function(result){
				//查询成功，展示页面
	        	var html="";
				html+="<input type='hidden' name='vehicleId' id='vehicleId' value='"+result.vehicleId+"'/>";
	        	html+="<input type='hidden' name='owner' id='owner' value='"+result.owner+"'/>";
	        	html+="<input type='hidden' name='registerDate' id='registerDate' value='"+result.registerDate+"'/>";
	        	html+="<input type='hidden' name='vehicleType' id='vehicleType' value='"+result.vehicleType+"'/>";
	        	html+="<input type='hidden' name='vin' id='vin' value='"+result.vin+"'/>";
	        	html+="<input type='hidden' name='plateNo' id='plateNo' value='"+result.plateNo+"'/>";
	        	html+="<input type='hidden' name='shopId' id='shopId' value='"+result.shopId+"'/>";
 				html += "<p class='page__desc' style='font-size: 24px; color: #FF9966; margin-bottom: 10px; line-height: 24px;'>请选择预约日期</p>";
				html += "<br />";
				html += '<div class="weui-tab">';

				html+='<div class="weui-navbar">';
				$.each(result.dataList,function(index,data){
					if(index == 0){
						html+='<div class="weui-navbar__item weui-bar__item_on one_select">'+data+'</div>';
					} else {
						html+='<div class="weui-navbar__item three_select">'+data+'</div>';
					}
				})
				html += "</div>";
				html += '<div class="weui-tab__panel">';
				html += '<br/><strong>请选择预约时间：</strong><br/><br/>';
				html += '<div class="page__bd page__bd_spacing">';
				html += '<div id="data_time_pannel"></div>';
				html += '</div>';
				html += '</div>';
				html += '</div>';
				
				var orig = $($("#tpl_checkcarconfirm").html());
				var ref = orig.find("#data_list_pannel").html(html);
				$("#tpl_" + id).html(orig);
		
				var objs = {
             		"shopId":result.shopId,
             		"vehicleId":result.vehicleId,
			 		"orderDate":result.dataList[0],
			 		"plateNo":result.plateNo,
			 		"owner":result.owner,
			 		"registerDate":result.registerDate,
					"vehicleType":result.vehicleType,
			 		"vin":result.vin};
				var saveDatas = JSON.stringify(objs);

				//查询验车日期界面
				checkCarDate(saveDatas);
				window.pageManager.go(id);
	        },
			error : function() {
				alert("查询失败");
			}
		})
	}

	function checkCar(id,oparams) {
		var params = new String(oparams).split("|");
		var obj = {"vehicleId":params[0],
				   "plateNo":params[1],
				   "orderDate":params[2],
				   "orderTime":params[3],
				   "shopId":params[4],
					"owner":params[5],
					"registerDate":params[6],
					"vehicleType":params[7],
					"vin":params[8]
				};
		var saveData = JSON.stringify(obj);
		var param = {
				saveData:saveData,
	   		}

		$('#checkcar_list_pannel').html("");//清空原数据
		$.ajax({
	        url: "checkCar",
	        dataType: 'json',
	        type: 'post',
	        data: param,
	        success: function(result){
				//查询成功，展示页面
	        	var html="";
					html+="<div class='weui-form-preview__hd'>";
	        		html+="<label class='weui-form-preview__label'>车牌号</label>";
	        		html+="<em class='weui-form-preview__value' style='color: #FF0000;'>"+result.plateNo+"</em></div>";
					html+="<div class='weui-form-preview__hd'>";
	        		html+="<label class='weui-form-preview__label'>预约时间</label>";
	        		html+="<em class='weui-form-preview__value' style='color: #00FF00;'>"+result.orderDate+"&nbsp;&nbsp;&nbsp;&nbsp;"+result.orderTime+"</em></div>";
	        		html+="<div class='weui-form-preview__bd'>";
	        		html+="<div class='weui-form-preview__item'>";
	        		html+="<label class='weui-form-preview__label'>车辆类型</label>";
	        		html+="<span class='weui-form-preview__value'>";
	        		if(result.vehicleType == '1'){
	        			html+="大型货车";
	        		} else if(result.vehicleType == '2'){
	        			html+="小型货车";
	        		} else if(result.vehicleType == '3'){
	        			html+="小型客车";
	        		}
	        		html+="</span></div>";
	        		html+="<div class='weui-form-preview__item'><label class='weui-form-preview__label'>行使证所有人</label>";
	        		html+="<span class='weui-form-preview__value'>"+result.owner+"</span></div><div class='weui-form-preview__item'>";
	        		html+="<label class='weui-form-preview__label'>车辆识别代码</label>";
	        		html+="<span class='weui-form-preview__value'>"+result.vin+"</span></div>";
	        		html+="<div class='weui-form-preview__item'><label class='weui-form-preview__label'>登记时间</label><span class='weui-form-preview__value'>";
	        		if(result.registerDate == 'a'){
	        			html+="6年以内";
	        		} else if(result.registerDate == 'b'){
	        			html+="6至10年";
	        		} else if(result.registerDate == 'c'){
	        			html+="10年以上";
	        		}
	        		html+="</span></div>";
	        		html+="</div>";
				
				var orig = $($("#tpl_checkcar").html());
				var ref = orig.find("#checkcar_list_pannel").html(html);
				$("#tpl_" + id).html(orig);
		
				window.pageManager.go(id);
	        },
			error : function() {
				alert("查询失败");
			}
		})
	}

	function checkCarDate(saveData){
		var params = {
				saveData:saveData,
	   		}
		$('#data_time_pannel').html("");//清空原数据
		$.ajax({
	        url: "checkDatatimeInfo",
	        dataType: 'json',
	        type: 'post',
	        data: params,
	        success: function(result){
	        	//查询成功，展示页面
	        	var timeHtml="";
	        	timeHtml+="<table class='weui-table weui-border-tb'>";
	        	timeHtml+='<thead><tr><th>可约车时间</th><th>剩余约车数量</th></tr></thead>';
	        	timeHtml+="<tbody>";
				$.each(result.data,function(index,data){
					if(data.flag == 'a'){
						timeHtml+="<tr><th>"+data.orderTime+"</th><td style='padding:10px;'><a href='javascript:alert(预约已满，请选择其他时间);' class='weui-btn weui-btn_warn'>预约已满</a></th></tr>";
					} else {
						var params = result.checkCar.vehicleId+"|"+result.checkCar.plateNo+"|"+result.checkCar.orderDate+"|"+data.orderTime+"|"+result.checkCar.shopId+"|"+result.checkCar.owner+"|"+result.checkCar.registerDate+"|"+result.checkCar.vehicleType+"|"+result.checkCar.vin;
						timeHtml+="<tr><th>"+data.orderTime+"</th><td style='padding:10px;'><a href='javascript:;' class='weui-btn weui-btn_primary js_item' data-id='checkcar' data-callback='checkCar' data-callback-param='"+params+"'>"+data.leftCount+"</a></th></tr>";	        			
					}
				})
	        	timeHtml+="</tbody>";
	        	timeHtml+="</table>";
				$("#data_time_pannel").html(timeHtml);
	       	},

			error : function() {
				alert("查询失败");
			}

		})
	}
</script>
</script>

<script type="text/html" id="tpl_mycheckcarmgmt">
		<div class='page'>
			<div class='page__hd'>
	        	<p class='page__desc' style='font-size: 24px; color: #FF9966; margin-bottom: 10px; line-height: 24px;'>我的车辆信息</p>
	        	<br/>
	        	<p class='page__desc' style='font-size: 18px; color: #513435; margin-bottom: 10px; line-height: 24px;'><img src='images/rm.png'> 王小二</p>
	        	<p class='page__desc' style='font-size: 18px; color: #513435; margin-bottom: 10px; line-height: 24px;'><img src='images/rx.png'> 18299988868</p>
	        	</div>
	        	<div class='weui-form-preview'>
					<div id="checkCarMgmt"></div>
				<div class='weui-form-preview'>
	        	<div class='weui-form-preview__hd'>
				<a href="javascript:;" class="js_item" data-id="checkcaraddpre" data-callback="checkCarAddPre">
           			<img src='images/sfz03.png' width='100%' />
        		</a>
	        	</div>
	        	</div>
	        	</div>
		</div>
</script>

<script type="text/html" id="tpl_myordermgmt">
	<div class='page'>
		<div class='page__hd'>
	        <p class='page__desc' style='font-size: 24px; color: #FF9966; margin-bottom: 10px; line-height: 24px;'>我的预约信息</p>
	        <br/>
	        <p class='page__desc' style='font-size: 18px; color: #513435; margin-bottom: 10px; line-height: 24px;'><img src='images/rm.png'> 王小二</p>
	        <p class='page__desc' style='font-size: 18px; color: #513435; margin-bottom: 10px; line-height: 24px;'><img src='images/rx.png'> 18299988868</p>
	        </div>
	        <div class='weui-form-preview'>
				<div id="orderMgmt"></div>
	        </div>
		</div>
	</div>
</script>

<script type="text/html" id="tpl_checkcaraddpre">
	<div class='page'>
		<div id="checkCarAddPre"></div>
	</div>
</script>

<script type="text/html" id="tpl_checkcaradd">
	<div class='page'>
		<div class='page__hd'>
	        <p class='page__desc' style='font-size: 24px; color: #FF9966; margin-bottom: 10px; line-height: 24px;'>我的车辆信息</p>
	        <br/>
	        <p class='page__desc' style='font-size: 18px; color: #513435; margin-bottom: 10px; line-height: 24px;'><img src='images/rm.png'> 王小二</p>
	        <p class='page__desc' style='font-size: 18px; color: #513435; margin-bottom: 10px; line-height: 24px;'><img src='images/rx.png'> 18299988868</p>
	        </div>
	        <div class='weui-form-preview'>
				<div id="checkCarAdd"></div>
			<div class='weui-form-preview'>
	        	<div class='weui-form-preview__hd'>
				<a href="javascript:;" class="js_item" data-id="checkcaraddpre" data-callback="checkCarAddPre">
           			<img src='images/sfz03.png' width='100%' />
        		</a>
	       		</div>
	       	</div>
	    </div>
	</div>
</script>

<script type="text/html" id="tpl_checkcarpre">
	<div class='page'>
		<div id="checkCarPre"></div>
	</div>
</script>

    <script type="text/html" id="tpl_checkcarconfirm">
		<div class='page'>
			<div class='page__hd' style="height: 100%;">
				<div id="data_list_pannel"></div>
   	 		</div>
		</div>
	<script type="text/javascript">
    $(function(){
        $('.weui-navbar__item').on('click', function () {
            $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
			//加在数据
			 var obj = {
             	"shopId":$("#shopId").val(),
             	"vehicleId":$("#vehicleId").val(),
			 	"plateNo":$("#plateNo").val(),
 			 	"owner":$("#owner").val(),
			 	"registerDate":$("#registerDate").val(),
			 	"vehicleType":$("#vehicleType").val(),
				"vin":$("#vin").val(),
				 "orderDate":"05-06"
				};
			var saveData = JSON.stringify(obj);

			checkCarDate(saveData);
        });
    });
</script>
</script>

<script type="text/html" id="tpl_checkcar">
	<div class='page'>
		<div class='page__hd'>
	        	<p class='page__desc' style='font-size: 24px; color: #FF9966; margin-bottom: 10px; line-height: 24px;'>恭喜您  已预约成功</p>
				<br>
	        	<div class='weui-form-preview'>
					<div id="checkcar_list_pannel"></div>
				</div>
		</div>
	</div>
</script>
	
    <script type="text/javascript" src="<%= request.getContextPath()%>/weui-1.1.1/dist/example/zepto.min.js"></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
    <script type="text/javascript" src="<%= request.getContextPath()%>/weui-1.1.1/dist/example/example.js"></script>
</body>
</html>
